package com.yizhu.zczy.advertising.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.advertising.entity.AdLocationEntity;
import com.yizhu.zczy.advertising.service.AdLocationService;




/**
 * 广告位置表
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 17:23:20
 */
@RestController
@RequestMapping("advertising/adlocation")
public class AdLocationController {
    @Autowired
    private AdLocationService adLocationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("advertising:adlocation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = adLocationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("advertising:adlocation:info")
    public R info(@PathVariable("id") Integer id){
		AdLocationEntity adLocation = adLocationService.getById(id);

        return R.ok().put("adLocation", adLocation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("advertising:adlocation:save")
    public R save(@RequestBody AdLocationEntity adLocation){
		adLocationService.save(adLocation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("advertising:adlocation:update")
    public R update(@RequestBody AdLocationEntity adLocation){
		adLocationService.updateById(adLocation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("advertising:adlocation:delete")
    public R delete(@RequestBody Integer[] ids){
		adLocationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
